<?php
namespace app\controller;

use think\Request;
use think\facade\Db;

class User 
{
    // 获取用户信息
    public function get(Request $request)
    {
        try {
            $openid = $this->getOpenid($request);
            
            $user = Db::table('users')
                ->where('openid', $openid)
                ->field('user_id,nickname,avatar_url,theme,city,create_time')
                ->find();

            return json(['code' => 0, 'data' => $user]);
            
        } catch (\Exception $e) {
            return $this->serverError($e);
        }
    }

    // 其他方法保持原逻辑不变...
    // ... 原有 update 等方法 ...
}
